package com.example.hand.dao;

import java.util.HashMap;
import java.util.List;

import com.example.hand.bean.Order;
import org.apache.ibatis.annotations.*;


@Mapper
public interface OrderDao {

//    @Select("select *from orders")
//    List<Order> getAll();//查询主页面

    @Delete ("delete from orders where order_id=#{order_id}")
    int deleteByPrimaryKey(int order_id);//删除

    @Select("select *from orders where order_id=#{order_id}")
    Order selecttest(Integer order_id);//进入修改页面，并且在input框里面拿到对应主页面的数据。


    @Insert("insert into orders(customer_id, staff_id, cargo,address,money,order_date,delivery_date,status) values (#{customer_id},#{staff_id},#{cargo},#{address},#{money},#{order_date},#{delivery_date},#{status})")
    int add(Order order);//添加货物信息

    @Update("update orders set customer_id=#{customer_id},staff_id=#{staff_id},cargo=#{cargo},address=#{address},money=#{money},order_date=#{order_date},delivery_date=#{delivery_date},status=#{status} where order_id=#{order_id}")
    int updateByPrimaryKeySelective(Order order);//修改执行

    @Select("select *from orders")
    List<Order> selectByAll();//修改后查询


    List<Order> selectDimGoods(String searchFor);
    List<Order> selectDimById(int searchFor);
    List<Order> selectDimOrder(Order order);
    List<Order> orderSelectAll();

    @Select("select count(*) from orders")//分页
    int selectCountOrder();

    @Select("select * from orders limit #{start},#{size}")
    List<Order> orderPage(HashMap<String, Integer> map);//分页sql对应的方法

    @Select("select *from orders where cargo LIKE #{query_content}")
    List<Order> queryOrderByLike(String content);//搜索框，根据名字查询。


}
